const pkg = require('./package');

module.exports = {
  mode: 'spa',

  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      {charset: 'utf-8'},
      {name: 'viewport', content: 'width=device-width, initial-scale=1'},
      {name: 'renderer', content: 'webkit'},
      {name: 'force-rendering', content: 'webkit'},
      {hid: 'description', name: 'description', content: pkg.description}
    ],
    link: [
      {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'},
    //  {rel: 'stylesheet', type: 'text/css', href: '/element-ui/theme-chalk/index.css'}
    ],
    // script: [
    //   {type:'text/javascript', src: '/element-ui/index.js'}
    // ],
  },

  /*
  ** Customize the progress-bar color
  */
  loading: {color: '#fff'},

  /*
  ** Global CSS
  */
  css: [
    'element-ui/lib/theme-chalk/index.css',
    '~assets/css/reboot.min.css',
    '~assets/fonts/iconfont.css',
    {
      src: '~assets/css/main.scss',
      lang: 'scss'
    }
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/element-ui',
    '@/plugins/axios-config',
    //'@/plugins/combined-inject',
    '@/plugins/test',
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios'
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
    //proxyHeaders: false
    baseURL: 'https://redpacket.wingkoo.mobi/hongbao',
    //baseURL: 'https://i95.me',
  },

  /*
  ** Build configuration
  */
  build: {
    analyze: false,
    maxChunkSize: 300000,
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
      // Run ESLint on save
      if (ctx.isDev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    },
    /*
    ** 引入全局scss变量
    */
    styleResources: {
      scss: './assets/css/main-variables.scss',
      options: {
        // See https://github.com/yenshih/style-resources-loader#options
        // Except `patterns` property
      }
    }
  }
};
